﻿using System.Windows;
using System.Windows.Controls;
using CuteRibs.WowArmory.Models;
using CuteRibs.WowArmory.ViewModels;
using System;

namespace CuteRibs.WowArmory.Views
{
	public partial class MainPageView : PageBase
	{
		private MainPageViewModel viewModel { get { return this.ViewModel as MainPageViewModel; } }

		public MainPageView()
		{
			InitializeComponent();
		}

		private void ListPicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			if (e.AddedItems != null && e.AddedItems.Count > 0)
			{
				this.viewModel.SelectRegion(e.AddedItems[0] as Region);
			}
		}

		private void TextBlock_Tap(object sender, EventArgs e)
		{
			var element = sender as FrameworkElement;
			this.viewModel.Navigate(element.Tag as string);
		}

		private void btnSearch_Click(object sender, EventArgs e)
		{
			this.viewModel.Navigate("search");
		}
	}
}